//
//  CollectController.m
//  QQplayground
//
//  Created by 王昭的Mac Air on 2018/6/10.
//  Copyright © 2018年 zhang. All rights reserved.
//

#import "CollectController.h"
#import "CollectListCell.h"

@interface CollectController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, copy) NSArray *titleArr;

@end

@implementation CollectController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"我的收藏";
    
    [self setNavigationBar];
    
    self.navigationController.navigationBarHidden = NO;
    // Do any additional setup after loading the view.
    
    _titleArr = @[@{@"title":@"头像",@"icon":@"收藏 头像",@"code":@"1"},
                  @{@"title":@"图片",@"icon":@"收藏 图片",@"code":@"2"},
                  @{@"title":@"壁纸",@"icon":@"收藏 壁纸",@"code":@"3"},
                  @{@"title":@"签名",@"icon":@"收藏 签名",@"code":@"4"},
                  @{@"title":@"网名",@"icon":@"收藏 网名",@"code":@"5"},
                  @{@"title":@"分组",@"icon":@"收藏 分组",@"code":@"6"},
                  @{@"title":@"自拍",@"icon":@"收藏 自拍",@"code":@"7"}];
    
    [self.view addSubview:self.tableView];
}

- (UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableView;
}


#pragma mark - tableView delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _titleArr.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.1f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.1f;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44.0f;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return [[UIView alloc] init];
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return [[UIView alloc] init];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"CollectListIdentifier";
    CollectListCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[CollectListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    [cell dataToView:_titleArr[indexPath.row]];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
